<style lang="scss">

</style>
<script>
	var _this = this;
	export default {
		onLaunch: function() {
			console.log('App Launch');
			console.log(this.url);
			// #ifdef APP-PLUS
			plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {  
				uni.request({  
			        url: _this.url+'sys/update/',  
			        data: {  
			            version: widgetInfo.version,  
			            name: widgetInfo.name  
			        },  
				
			        success: (result) => {  
			            var data = result.data; 
			            if (data.data.update && data.data.wgtUrl) {  
			                uni.downloadFile({  
			                    url: data.data.wgtUrl,  
			                    success: (downloadResult) => {  
			                        if (downloadResult.statusCode === 200) { 
										console.log('start install ......')
										console.log(downloadResult.tempFilePath);
			                            plus.runtime.install(downloadResult.tempFilePath, {  
			                                force: false  
			                            }, function() {  
			                                console.log('install success...');  
			                                plus.runtime.restart();  
			                            }, function(e) {  
			                                console.error('install fail...');  
			                            });  
			                        }  
			                    }  
			                });  
			            }  
			        }  
			    });  
			});  
			
			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	@import "./common/uni.css";
</style>
